﻿Set-Location $PSScriptRoot
[System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8

. .\Git.ps1

# 备份工作目录
$backLocation = Get-Location

# 设置仓库目录
$repositoryDirectory = "D:\MyDocument\我的笔记"

# 切换到仓库目录
Set-Location $repositoryDirectory

$currentCommitHash = git show --no-patch --format="" --pretty=format:%Cred%H
$currentCommitHash

$changedFiles = git show --name-status --format=""
$changedFiles

# 恢复调用上下文工作目录
Set-Location $backLocation

$octalValue = [Convert]::ToInt32("346",8)
[System.Char]$octalValue


#    static void Main()
#    {
#        Regex regex = new Regex(@"\\[0-9]{3,}");
#        var result = regex.Replace(
#            "Git \\346\\225\\231\\347\\250\\213/git show \\346\\237\\245\\347\\234\\213\\346\\217\\220\\344\\272\\244\\344\\277\\241\\346\\201\\257.md",
#            (match) =>
#            {
#                var value = match.Value.TrimStart('\\');
#                var byteValue = Convert.ToByte(value, 8);
#                var hexString = Convert.ToHexString(new byte[] { byteValue });
#                return $"%{hexString}";
#            });
#        Console.WriteLine(result);
#        var value = System.Web.HttpUtility.UrlDecode(result);
#        Console.WriteLine(value);
#    }